package br.com.dufs.mvc.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import br.com.dufs.mvc.dao.interfaces.SemoventesSistemaProducaoDAO;
import br.com.dufs.mvc.model.SemoventesSistemaProducao;

import com.fscoreunipe.mvc.dao.impl.generico.DaoGenericoImpl;

@Repository("semoventesSistemaProducaoDAO")
public class SemoventesSistemaProducaoDAOImpl extends DaoGenericoImpl<SemoventesSistemaProducao, String> implements
		SemoventesSistemaProducaoDAO {

	private Query query;

	@Transactional(readOnly = false)
	@Override
	public SemoventesSistemaProducao pesquisarPorCPF(String id) {
		// TODO Auto-generated method stub

		SemoventesSistemaProducao retorno = new SemoventesSistemaProducao();

		this.query = getSessionFactory().getCurrentSession().createQuery(
				"From SemoventesSistemaProducao where  entrevistado='" + id + "'");

		if (this.query.uniqueResult() != null) {
			retorno = (SemoventesSistemaProducao) this.query.uniqueResult();
		}
		return retorno;

	}

	
}
